<?php

use Illuminate\Database\Seeder;

class AdminPermissionTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $list = \App\Models\Admin\Menu::get();
        foreach ($list as $key=>$value) {
            $permission = new \App\Models\Admin\Permission();
            $permission->name = $value->slug;
            $permission->display_name = $value->name;
            $permission->description = $value->description;
            $permission->save();
        }
        /*$sql = "INSERT INTO `exp_admin_permissions` (`id`, `name`, `display_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'admin-systems-index', '控制台', NULL, '2017-10-23 17:11:03', '2017-10-23 17:11:03'),
(2, 'admin-systems-manage', '系统管理', NULL, '2017-10-23 17:12:13', '2017-10-23 17:12:13'),
(3, 'admin-users-list', '用户管理', NULL, '2017-10-23 17:14:15', '2017-10-23 17:14:15'),
(4, 'admin-users-edit', '更新用户信息', NULL, '2017-10-23 17:14:21', '2017-10-23 17:18:37'),
(5, 'admin-users-delete', '删除管理员信息', NULL, '2017-10-23 17:14:25', '2017-10-23 17:14:25'),
(6, 'admin-roles-list', '角色管理', NULL, '2017-10-23 17:14:44', '2017-10-23 17:14:44'),
(7, 'admin-roles-edit', '更新角色信息', NULL, '2017-10-23 17:14:48', '2017-10-23 17:14:48'),
(8, 'admin-roles-delete', '删除角色', NULL, '2017-10-23 17:14:52', '2017-10-23 17:14:52'),
(9, 'admin-roles-permission', '绑定权限', NULL, '2017-10-23 17:14:55', '2017-10-23 17:14:55'),
(10, 'admin-menus-list', '菜单管理', NULL, '2017-10-23 17:14:58', '2017-10-23 17:14:58'),
(11, 'admin-menus-edit', '更新菜单信息', NULL, '2017-10-23 17:15:01', '2017-10-23 17:15:01'),
(12, 'admin-menus-delete', '删除菜单信息', NULL, '2017-10-23 17:15:04', '2017-10-23 17:15:04');";

        \Illuminate\Support\Facades\DB::select($sql);*/
    }
}
